 //----------------------------------------------------------------------------
  // Menu
  //----------------------------------------------------------------------------
  $.fn.menu = function(params){
    var base         = this;
    var originHeight = 0;
    var bigHeight    = 0; 
    base.$el         = $(base);
    base.el          = base;

    base.init = function(){
      originHeight = base.$el.innerHeight();
      bigHeight    = parseInt(getRuleStyle(base.selector + '.big', 'height'));
    
      this.links = base.$el.find('a').fadeOthers();
      base.listen();
    };
    
    base.open = function(){
      base.$el.slideDown();
    };
    
    base.close = function(){
      base.$el.slideUp();
      base.$el.css('height', base.$el.data('originHeight'));
    }; 
   
    base.listen = function() { 
      base.$el.find('a').add('#logo').bind('click', function() {
        var status = base.status();
        switch($(this).attr('name')) {
          case 'home':
            if ( status != 'closed' ) {
              base.close();
              base.bigClose();
            }
            break;
            
          case 'bio':
          case 'contact':
          case 'infos':
            if ( status != 'bigOpened' ) base.bigOpen();
            base.select($(this));
            break;
            
          case 'evenementiel':
          case 'travaux':
          case 'ceremonies':
          case 'portraits':
            if ( status == 'bigOpened') base.bigClose();
            else if ( status != 'opened' ) base.open();
            base.select($(this));
        }
        base.$el.trigger('status', {
          item: $(this)
        });
        return false;
      });
    };
    
    base.select = function(elem) {
      var elem = $(elem);
      var elems = base.$el.find('a.selected');
  
      if ( elems.size() > 0) {
        var diff = elem.offset().left - elems.offset().left + round(elem.outerWidth()/2,1);
        if ( diff != 0 ) { 
          var span = elems.find('span');
          span.data('left', span.css('left'));
          elems.find('span').stop().animate({
            'left': diff
          }, function() { 
            elems.removeClass('selected');
            elem.addClass('selected');
            span.css('left', '50%');
          });
          return;
        }        
      }
     
      elems.removeClass('selected');
      elem.addClass('selected');     
    };
    
    base.bigOpen = function() {  
      var diff = bigHeight - 95; 
      var originBottom = $('#logo').css('bottom');
      base.$el.animate({
        height: bigHeight
      });
      
      $('#logo').animate({
        bottom: diff
      });
    };
    
    base.bigClose = function() {
      base.$el.animate({
        height: originHeight
      });
      
      $('#logo').animate({
        bottom: 5
      });
    }
    
    base.status = function() {
      if ( !base.is(':visible') ) {
        return 'closed';
      }
      else {
        return (parseInt(base.$el.css('height')) == bigHeight) ? 'bigOpened' : 'opened';        
      }
    }
       
    base.init();
    return base;
  };
  